﻿using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using iTravel.Data;

namespace iTravel.Repository.Test
{
    [TestClass]
    public class FlightRepositoryTest : TransactionalTest
    {
        [TestMethod] 
        public void GetAll_ShouldReturnAtLeastOneItem()
        {
            using (TravelContext context = new TravelContext())
            {
                context.Flights.Add(new Flight { Number= "123" });
                context.SaveChanges();
            }

            FlightRepository repository = new FlightRepository();
            var flight = repository.All().ToList().Single(f=>f.Number == "123");

            Assert.IsNotNull(flight);
        }
    }
}